package com.yj.common.enums;

import com.google.gson.annotations.SerializedName;

/**
 * Copyright 2017 (C) Yunjian-VC
 * Created on : 2017/12/12
 * Author     : Unbelievable9
 **/
public enum InventoryType {

    /**
     * 1 矿
     * 2 货场
     * 3 站台
     * 4 港口
     */

    @SerializedName("1")
    MINE(1),

    @SerializedName("2")
    FACTORY(2),

    @SerializedName("3")
    STATION(3),

    @SerializedName("4")
    PORT(4);

    private final Integer value;

    private static final int size = InventoryType.values().length;

    private InventoryType(Integer value) {
        this.value = value;
    }

    public Integer getValue() {
        return value;
    }

    public static int getSize() {
        return size;
    }

    public static InventoryType fromValue(Integer value) {
        for (InventoryType inventoryType : InventoryType.values()) {
            if (inventoryType.getValue().equals(value)) {
                return inventoryType;
            }
        }

        return null;
    }
}
